<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>我的家庭</title>
  <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  <style>
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      background-color: #f5f5f5;
      color: #333;
      padding-bottom: 70px;
    }
    .t-card {
      background: white;
      border-radius: 12px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      padding: 16px;
      margin-bottom: 16px;
    }
    .t-card-header {
      font-size: 18px;
      font-weight: 600;
      color: #0052d9;
      margin-bottom: 12px;
    }
    .t-tabbar {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      display: flex;
      background: white;
      box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
      height: 60px;
      z-index: 100;
    }
    .t-tabbar-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #666;
      font-size: 12px;
    }
    .t-tabbar-item.active {
      color: #0052d9;
    }
    .t-tabbar-icon {
      font-size: 24px;
      margin-bottom: 2px;
    }
    .t-button {
      display: block;
      width: 100%;
      padding: 12px;
      border-radius: 8px;
      text-align: center;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }
    .t-button-primary {
      background-color: #0052d9;
      color: white;
    }
    .t-button-primary:hover {
      background-color: #003db3;
    }
    .t-button-outline {
      border: 1px solid #0052d9;
      color: #0052d9;
      background-color: white;
    }
    .t-button-outline:hover {
      background-color: #f0f7ff;
    }
    .t-input {
      width: 100%;
      padding: 10px 12px;
      border: 1px solid #dcdcdc;
      border-radius: 6px;
      margin-bottom: 12px;
      font-size: 14px;
    }
    .t-input:focus {
      border-color: #0052d9;
      outline: none;
    }
    .t-input-label {
      display: block;
      font-size: 14px;
      color: #666;
      margin-bottom: 4px;
    }
    .t-avatar {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid #0052d9;
    }
    .user-info {
      display: flex;
      align-items: center;
      margin-bottom: 20px;
    }
    .user-name {
      margin-left: 16px;
      font-size: 18px;
      font-weight: 500;
    }
    .member-card {
      background-color: white;
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 16px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    .member-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      padding-bottom: 8px;
      border-bottom: 1px solid #eee;
    }
    .member-name {
      font-size: 16px;
      font-weight: 600;
      color: #0052d9;
    }
    .member-action {
      color: #666;
      font-size: 20px;
    }
    .member-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }
    .login-container {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 50vh;
      text-align: center;
    }
    .login-icon {
      font-size: 64px;
      margin-bottom: 16px;
      color: #0052d9;
    }
    .login-text {
      margin-bottom: 24px;
      color: #666;
    }
  </style>
</head>
<body>
  <div class="p-4">
    <!-- 未登录状态 -->
    <div id="not-logged-in" class="hidden">
      <div class="login-container">
        <div class="login-icon">👤</div>
        <div class="login-text">登录后可查看和管理家庭成员信息</div>
        <button class="t-button t-button-primary" onclick="login()">微信一键登录</button>
      </div>
    </div>

    <!-- 已登录状态 -->
    <div id="logged-in">
      <!-- 用户信息 -->
      <div class="t-card">
        <div class="user-info">
          <img src="https://placekitten.com/200/200" alt="用户头像" class="t-avatar">
          <div class="user-name">张小厨</div>
        </div>
      </div>

      <!-- 家庭成员信息 -->
      <div class="t-card">
        <div class="t-card-header">家庭成员信息</div>

        <!-- 成员1 -->
        <div class="member-card">
          <div class="member-header">
            <div class="member-name">爸爸</div>
            <div class="member-action">✏️</div>
          </div>
          <div class="member-grid">
            <div>
              <label class="t-input-label">年龄</label>
              <input type="text" class="t-input" value="45" readonly>
            </div>
            <div>
              <label class="t-input-label">身高(cm)</label>
              <input type="text" class="t-input" value="175" readonly>
            </div>
            <div>
              <label class="t-input-label">体重(kg)</label>
              <input type="text" class="t-input" value="70" readonly>
            </div>
            <div>
              <label class="t-input-label">忌口</label>
              <input type="text" class="t-input" value="海鲜" readonly>
            </div>
            <div>
              <label class="t-input-label">喜好</label>
              <input type="text" class="t-input" value="牛肉、土豆" readonly>
            </div>
          </div>
        </div>

        <!-- 成员2 -->
        <div class="member-card">
          <div class="member-header">
            <div class="member-name">妈妈</div>
            <div class="member-action">✏️</div>
          </div>
          <div class="member-grid">
            <div>
              <label class="t-input-label">年龄</label>
              <input type="text" class="t-input" value="42" readonly>
            </div>
            <div>
              <label class="t-input-label">身高(cm)</label>
              <input type="text" class="t-input" value="165" readonly>
            </div>
            <div>
              <label class="t-input-label">体重(kg)</label>
              <input type="text" class="t-input" value="55" readonly>
            </div>
            <div>
              <label class="t-input-label">忌口</label>
              <input type="text" class="t-input" value="辣椒" readonly>
            </div>
            <div>
              <label class="t-input-label">喜好</label>
              <input type="text" class="t-input" value="蔬菜、水果" readonly>
            </div>
          </div>
        </div>

        <!-- 新建成员按钮 -->
        <button class="t-button t-button-outline mb-4" onclick="addNewMember()">+ 新建成员</button>
        
        <!-- 生成食谱按钮 -->
        <button class="t-button t-button-primary" onclick="generateRecipe()">一键生成推荐食谱</button>
      </div>
    </div>
  </div>

  <!-- 底部导航栏 -->
  <div class="t-tabbar">
    <div class="t-tabbar-item">
      <div class="t-tabbar-icon">🏠</div>
      <div>首页</div>
    </div>
    <div class="t-tabbar-item active">
      <div class="t-tabbar-icon">👨‍👩‍👧‍👦</div>
      <div>我的家庭</div>
    </div>
    <div class="t-tabbar-item">
      <div class="t-tabbar-icon">📷</div>
      <div>我的摄像头</div>
    </div>
  </div>

  <script>
    // 模拟登录状态，实际应用中应该从服务器获取
    const isLoggedIn = true;
    
    function login() {
      document.getElementById('not-logged-in').classList.add('hidden');
      document.getElementById('logged-in').classList.remove('hidden');
    }
    
    function addNewMember() {
      const memberCard = document.createElement('div');
      memberCard.className = 'member-card';
      memberCard.innerHTML = `
        <div class="member-header">
          <div class="member-name">
            <input type="text" class="t-input" placeholder="成员姓名" style="margin-bottom: 0;">
          </div>
          <div class="member-action">❌</div>
        </div>
        <div class="member-grid">
          <div>
            <label class="t-input-label">年龄</label>
            <input type="text" class="t-input" placeholder="年龄">
          </div>
          <div>
            <label class="t-input-label">身高(cm)</label>
            <input type="text" class="t-input" placeholder="身高">
          </div>
          <div>
            <label class="t-input-label">体重(kg)</label>
            <input type="text" class="t-input" placeholder="体重">
          </div>
          <div>
            <label class="t-input-label">忌口</label>
            <input type="text" class="t-input" placeholder="忌口食物">
          </div>
          <div>
            <label class="t-input-label">喜好</label>
            <input type="text" class="t-input" placeholder="喜好食物">
          </div>
        </div>
      `;
      
      const addButton = document.querySelector('.t-button-outline');
      addButton.parentNode.insertBefore(memberCard, addButton);
    }
    
    function generateRecipe() {
      alert('正在生成食谱，请稍候...');
      // 实际应用中应该调用API生成食谱
    }
    
    // 页面加载时检查登录状态
    window.onload = function() {
      if (isLoggedIn) {
        document.getElementById('not-logged-in').classList.add('hidden');
        document.getElementById('logged-in').classList.remove('hidden');
      } else {
        document.getElementById('not-logged-in').classList.remove('hidden');
        document.getElementById('logged-in').classList.add('hidden');
      }
    };
  </script>
</body>
</html> 